﻿namespace HySoft.Cash.Business
{
    using Huayou.Common.Database;
    using Huayou.Utils;
    using HySoft.Cash.BaseClass;
    using HySoft.Cash.DB;
    using HySoft.Cash.Structure;
    using System;
    using System.Data;
    using System.Web.UI;

    public class TuptreportBN : BaseBusiness
    {
        private TuptreportDB db;

        public TuptreportBN(Page page) : base(page)
        {
            this.db = null;
            this.db = new TuptreportDB(base.curDBOperater);
        }

        public TuptreportBN(Page page, DBOperate oper) : base(page, oper)
        {
            this.db = null;
            this.db = new TuptreportDB(base.curDBOperater);
        }

        public bool Add(TuptreportDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Add(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public bool Delete(int Sid)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Delete(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public void Dispose()
        {
            base.Dispose();
            if (this.db != null)
            {
                this.db = null;
            }
        }

        public bool Edit(TuptreportDT detail)
        {
            bool flag = false;
            try
            {
                try
                {
                    flag = this.db.Edit(detail);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return flag;
        }

        public TuptreportDT Get(int Sid)
        {
            TuptreportDT tdt = null;
            try
            {
                try
                {
                    tdt = this.db.Get(Sid);
                }
                catch (Exception exception)
                {
                    throw exception;
                }
            }
            finally
            {
            }
            return tdt;
        }

        public DataTable GetList()
        {
            base.DBFieldList = "Sid,EmpSid,UptDate,EffectedCode,ChangedFrom,ChangedTo,ChangedBy,OrgSid";
            base.DBTable = "tUptReport";
            return base.CommonGetList();
        }

        public void QueryChangedBy(string ChangedBy)
        {
            if ((ChangedBy != null) && (ChangedBy.Trim() != ""))
            {
                base.Filter = "ChangedBy like '%" + StringUtils.ToSQL(ChangedBy) + "%'";
            }
        }

        public void QueryChangedFrom(string ChangedFrom)
        {
            if ((ChangedFrom != null) && (ChangedFrom.Trim() != ""))
            {
                base.Filter = "ChangedFrom like '%" + StringUtils.ToSQL(ChangedFrom) + "%'";
            }
        }

        public void QueryChangedTo(string ChangedTo)
        {
            if ((ChangedTo != null) && (ChangedTo.Trim() != ""))
            {
                base.Filter = "ChangedTo like '%" + StringUtils.ToSQL(ChangedTo) + "%'";
            }
        }

        public void QueryEffectedCode(string EffectedCode)
        {
            if ((EffectedCode != null) && (EffectedCode.Trim() != ""))
            {
                base.Filter = "EffectedCode like '%" + StringUtils.ToSQL(EffectedCode) + "%'";
            }
        }

        public void QueryEmpSid(int EmpSid)
        {
            base.Filter = "EmpSid= " + EmpSid;
        }

        public void QueryOrgSid(int OrgSid)
        {
            base.Filter = "OrgSid= " + OrgSid;
        }

        public void QuerySid(int Sid)
        {
            base.Filter = "Sid= " + Sid;
        }

        public void QueryUptDate(string UptDate)
        {
            if ((UptDate != null) && (UptDate.Trim() != ""))
            {
                base.Filter = "UptDate like '%" + StringUtils.ToSQL(UptDate) + "%'";
            }
        }
    }
}

